﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TsCore
{
    public class Match
    {
        public Int32 MatchId { get; set; }
        public DateTime Date { get; set; }
        public String Name { get; set; }
        public Team HomeTeam { get; set; }
        public Team VisitorTeam { get; set; }
        public Int32 Winner { get; set; }
        public virtual List<Media> MediaList { get; set; }

        public Match()
        {
        }

        public Match(DateTime date, String name)
        {
            this.Date = date.Date;
            this.Name = name;
        }

        public Match(DateTime date, Team homeTeam, Team visitorTeam)
        {
            this.Date = date.Date;
            this.HomeTeam = homeTeam;
            this.VisitorTeam = visitorTeam;
            this.Winner = -1;
            this.MediaList = new List<Media>();
            this.Name = homeTeam.Name + " vs " + visitorTeam.Name; 
        }

        public Match(DateTime date, Team homeTeam, Team visitorTeam, String name)
        {
            this.Date = date.Date;
            this.HomeTeam = homeTeam;
            this.VisitorTeam = visitorTeam;
            this.Name = name;
        }

        public override string ToString()
        {
            return this.Name;
        }

        public override bool Equals(object obj)
        {
            return this.MatchId == ((Match)obj).MatchId;
        }
    }
}
